import Vue from "vue";
//import Antd from "ant-design-vue"  全局引入,速度慢

import VueI18n from "vue-i18n";
import App from "./App.vue";
import router from "./router";
import store from "./store/index";
//import 'ant-design-vue/dist/antd.less';
import { Button,Layout,Icon,Drawer,Radio,Menu,Form,Input,
  Select,LocaleProvider,Dropdown,DatePicker
} from "ant-design-vue";
//import "ant-design-vue/lib/button/style";//因为只需要button样式所以，省去上传js的容量，速度更快
import Authorized from './components/Authorized';
import Auth from './directives/auth'

import zhCN from './locale/zhCN'
import queryString from 'query-string'
import enUS from "./locale/enUS";
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/github.css'

Vue.config.productionTip = false;

Vue.use(Button);
Vue.use(Layout);
Vue.use(Icon);
Vue.use(Drawer);
Vue.use(Radio);
Vue.use(Menu);
Vue.component('Authorized',Authorized);
Vue.use(Auth);
Vue.use(Form);
Vue.use(Input);
Vue.use(Select);
Vue.use(LocaleProvider);
Vue.use(Dropdown);
Vue.use(DatePicker);
Vue.use(VueI18n);
Vue.use(VueHighlightJS);

const i18n = new VueI18n({
  locale: queryString.parse(location.search).locale || 'zhCN',
  messages: {
    zhCN: {message: zhCN},
    enUS: {message: enUS}
  }
});

const IconFont = Icon.createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_2692786_a7x4fwstpy9.js', // 在 iconfont.cn 上生成
});

Vue.component("IconFont",IconFont);

new Vue({
  i18n,
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
